﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace QLKS.ViewModels
{
    static public class LoginViewModel
    {
        static public string username = string.Empty;

        //Lấy thông tin user
        static public DataTable GetUserInfo(string username)
        {
            return Models.LoginModel.GetUserInfo(username);
        }
        //Kiểm tra đăng nhập
        static public bool Login(string username, string password)
        {
            return Models.LoginModel.Login(username, password);
        }

        //Thay đổi mật khẩu
         //Thay đổi mật khẩu
        static public bool ThayDoiMatKhau(string username, string newPassword)
        {
            return Models.LoginModel.ThayDoiMatKhau(username, newPassword);
        }
        //nhớ mật khẩu
        static public void RememberLogin(bool active)
        {
            Models.LoginModel.RememberLogin(active);
        }

        //kiểm tra có nhớ mật khẩu
        static public bool CheckRememberLogin()
        {
           bool check = Models.LoginModel.CheckRememberLogin();
           if (check)
               username = Models.LoginModel.username;
           return check;
        }

        static public string GetOldUsername()
        {
            return Models.LoginModel.GetOldUsername();
        }

        static public bool SaveLogin()
        {
            return Models.LoginModel.SaveLogin();
        }

        //Load History Login
        static public DataTable LoadHistoryLogin()
        {
            return Models.LoginModel.LoadHistoryLogin();
        }
        static public string DatabaseName { get { return Models.DataProviderModel.DatabaseName; } }
        static public string ServerName { get { return Models.DataProviderModel.ServerName; } }
    }
}
